package com.rx.core.enm;

import com.rx.core.base.RxBaseException;

/**
 * 所有版权归 广西梧州 陈锦韬 所有
 *
 * @version V1.0
 * @Title: RX_LOG_MODE
 * @Package com.rx.core.enm
 * @Description: 日志打印模式
 * @author: 陈锦韬
 * @date: 2020\8\23 0023
 * @Copyright: 2020 陈锦韬  All rights reserved.
 */
public enum RX_LOG_MODE {
    DEFAULT("[{}]:"),
    REVC("[报文接收]:"),
    RESP("[报文响应]:"),
    REG_CHAIN( "[注册服务链]:URL:{},链:{}"),
    EXE_CHAIN( "[循环执行链]:名称:{},子链个数:{}"),
    EXE_CHAIN_DONE( "[循环执行链]:名称:{},完成执行"),
    EXE_CHAIN_START( "[开始执行链]:名称:{}......"),
    EXE_CHAIN_END( "[结束执行链]:名称:{}"),
    REG_DATA( "[注册注解RxData]:类:{}"),
    REG_HANDLER( "[注册注解RxHandler]:类:{}"),
    ANN_DATA( "[注解RxData]："),
    ANN_HANDLER( "[注解RxHandler]："),
    URL_ERROR( "[路径异常]："),
    HANDLER_INFO( "[处理器信息]："),
    ERROR("[ERROR]:"),
    ;
    String value;
    public static final String FREFIX = ">>>RX ";
    private RX_LOG_MODE(String value) {
        this.value = RX_LOG_MODE.FREFIX + value;
    }
    public String getFormat(){
        return this.value;
    }
    public String getFormat(String format){
        return this.value + format;
    }
    public String getFormat(RxBaseException rxBaseException){
        return this.value + "["+rxBaseException.getResultCode()+"]"+rxBaseException.getResultMessage();
    }
    public String getFormat(Throwable e){
        return this.value + e.getMessage();
    }
}
